/**
 * Copyright (C) 2010 KingCore Science & Technology CO,.LTD. All rights reserved.
 * XNS PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
 */

/**
 * Copyright (C) 2002-2010 WUZEWEN. All rights reserved.
 * WUZEWEN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
 *
 * This software is the confidential and proprietary information of
 * WuZeven, Personal. ("Confidential Information").  You shall not
 * disclose such Confidential Information and shall use it only in
 * accordance with the terms of the license agreement you entered into
 * with WuZeven.
 */

package com.kingcore.director;

import java.io.File;
import java.io.Serializable;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;

/**
 * <p>java class file describe</p>
 * @author Zeven on 2010-8-30
 * @version	1.0
 * @see		Object#equals(java.lang.Object)
 * @since	JDK5
 */

public class DirectorContext implements Serializable{

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private static boolean isAwokeCloseEnabled = true;   // is awoke window close enabled
	private static String userDataPath = null;           //user data path
	private static int mainFrameWidth ;  
	private static int mainFrameHeight ;     
	
	private static ScheduledExecutorService scheduler = 
            Executors.newScheduledThreadPool(3);  //整个app共享的线程池
    
	public static ScheduledExecutorService getScheduler() {
		return scheduler;
	}

	public static int getMainFrameWidth() {
		return mainFrameWidth;
	}

	public static void setMainFrameWidth(int mainFrameWidth) {
		DirectorContext.mainFrameWidth = mainFrameWidth;
	}

	public static int getMainFrameHeight() {
		return mainFrameHeight;
	}

	public static void setMainFrameHeight(int mainFrameHeight) {
		DirectorContext.mainFrameHeight = mainFrameHeight;
	}
	
	public static String getUserDataPath() {
		return userDataPath;
	}

	public static void setUserDataPath(String userDataPath) {
		DirectorContext.userDataPath = userDataPath;
	}

	public static boolean isAwokeCloseEnabled() {
		return isAwokeCloseEnabled;
	}

	public static void setAwokeCloseEnabled(boolean isAwokeCloseEnabled) {
		DirectorContext.isAwokeCloseEnabled = isAwokeCloseEnabled;
	}

	/**
	 * <p>java method describe</p>
	 * @author Zeven on 2010-8-30
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
	}
	
	static{
		//确保临时目录存在
		String tmpDir = System.getProperty("java.io.tmpdir")
					+File.separator+"SystemDirector";
		if (new File(tmpDir).exists()==false) {
			new File(tmpDir).mkdirs();
		}
	}
	
	private static String SystemTmpDir = System.getProperty("java.io.tmpdir")
							+File.separator+"SystemDirector";
	/**
	 * //系统临时目录 如WinXP下类似：D:\Documents And Settings\Zeven\Local Settings\Temp\SystemDirector
	 * //OS临时目录：程序运行时候创建的临时文件或数据使用-完全与程序分离；
	 * //程序文件与数据文件分离，特别是临时数据文件，产生的不可直接打开的文件
	 * @return
	 */
	public static String getSystemTmpDir() {
		return SystemTmpDir;
	}

	private static String AppHomeDir = System.getProperty("user.dir");
	/**
	 * 
	 * //应用程序根目录
	 * @return
	 */
	public static String getAppHomeDir() {
		return AppHomeDir;
	} 
	
	private static String AppTmpDir = System.getProperty("user.dir")+File.separator+"tmp";
	/**
	 * 
	 * //应用程序临时目录
	 * //程序临时目录：程序产生的需长久保存的文件或数据使用-建议与程序分离；
	 * @return
	 */
	public static String getAppTmpDir() {
		return AppTmpDir;
	} 
}
